package thread.wang_bao_ling.c14;

import java.util.concurrent.locks.LockSupport;

/**
 * @Auther: luobiao
 * @Date: 2020/7/5 10:33
 * @Description:
 */
public class DemoLockSupport {
    public static void main(String[] args) throws InterruptedException {
        Thread t1=new Thread(()->{
            System.out.println("begin1 park");
            LockSupport.park();
            //System.out.println(Thread.interrupted()); 如果调用interrupted会重置中断状态
            System.out.println(Thread.currentThread().isInterrupted());
            System.out.println("end2 park");
            System.out.println("begin2 park");
            LockSupport.park();
            System.out.println(Thread.currentThread().isInterrupted());
            System.out.println("end2 park");
            LockSupport.park();
        });
        t1.start();
        Thread.sleep(1000);
        //t1.interrupt();

    }
}
